SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO

BEGIN TRANSACTION
GO
PRINT N'Creating [SplendidCRM] schemata'
GO
CREATE SCHEMA [TheWall]
AUTHORIZATION [dbo]
GO

PRINT N'Creating [SplendidCRM].[SchemaChanges]'
GO
CREATE TABLE [dbo].[SchemaChanges](
	[SchemaChangeID] [int] IDENTITY(1,1) NOT NULL,
	[MajorReleaseNumber] [varchar](50) NOT NULL,
	[MinorReleaseNumber] [varchar](50) NOT NULL,
	[BuildReleaseNumber] [varchar](50) NOT NULL,
	[RevisionReleaseNumber] [varchar](50) NOT NULL CONSTRAINT [DF_SchemaChanges_RevisionReleaseNumber_1]  DEFAULT ((0)),
	[ScriptName] [varchar](50) NOT NULL UNIQUE,
	[DateApplied] [datetime] NOT NULL,
	[Description] [nvarchar](250) NULL,
 CONSTRAINT [PK_SchemaChanges] PRIMARY KEY CLUSTERED 
(
	[SchemaChangeID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

GO

-- Record the script update
INSERT INTO [dbo].[SchemaChanges]
       ([MajorReleaseNumber]
       ,[MinorReleaseNumber]
       ,[BuildReleaseNumber]
       ,[RevisionReleaseNumber]
       ,[ScriptName]
       ,[DateApplied]
       ,[Description])
VALUES
       ('1'
       ,'00'
       ,'01'
       ,'001'
       ,'Upgrade-1.00.01.001.sql'	   
       ,GETDATE()
	   ,'')
	  
COMMIT TRANSACTION